import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/components/Layout.vue'
import Dashboard from '@/views/Dashboard.vue'
import MemberManagement from '@/views/MemberManagement.vue'
import ProductManagement from '@/views/ProductManagement.vue'
import Cashier from '@/views/Cashier.vue'
import OrderManagement from '@/views/OrderManagement.vue'
import SalesReport from '@/views/SalesReport.vue'

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [
      {
        path: 'dashboard',
        name: 'Dashboard',
        component: Dashboard,
        meta: { title: '仪表盘' }
      },
      {
        path: 'members',
        name: 'MemberManagement',
        component: MemberManagement,
        meta: { title: '会员管理' }
      },
      {
        path: 'products',
        name: 'ProductManagement',
        component: ProductManagement,
        meta: { title: '商品管理' }
      },
      {
        path: 'cashier',
        name: 'Cashier',
        component: Cashier,
        meta: { title: '收银台' }
      },
      {
        path: 'orders',
        name: 'OrderManagement',
        component: OrderManagement,
        meta: { title: '订单管理' }
      },
      {
        path: 'sales',
        name: 'SalesReport',
        component: SalesReport,
        meta: { title: '销售报表' }
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router 